package com.zsoft.dao;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zsoft.domain.TopicDomain;

class test1 implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String age;

	public String getAge() {
		return age;
	}

	public void setAge(String age) {
		this.age = age;
	}

}

public class test implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String name;
	private String[] likes;
	private List likelist;
	private test1 t1;

	public test1 getT1() {
		return t1;
	}

	public void setT1(test1 t1) {
		this.t1 = t1;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String[] getLikes() {
		return likes;
	}

	public void setLikes(String[] likes) {
		this.likes = likes;
	}

	public List getLikelist() {
		return likelist;
	}

	public void setLikelist(List likelist) {
		this.likelist = likelist;
	}

	public Object deepCopy() throws IOException, ClassNotFoundException {
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		ObjectOutputStream o = new ObjectOutputStream(out);
		o.writeObject(this);

		ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
		ObjectInputStream ins = new ObjectInputStream(in);
		return ins.readObject();
	}

	public static void main(String[] args) throws CloneNotSupportedException, IOException, ClassNotFoundException {
//		test t = new test();
//		t.setLikes(new String[] { "a", "b" });
//		t.setName("jack");
//		List l = new ArrayList();
//		l.add("a");
//		l.add("b");
//		t.setLikelist(l);
//		System.out.println(t.hashCode());
//
//		test t2 = (test) t.deepCopy();
//		l.add("c");
//		t.setLikelist(l);
//		System.out.println(t2.getName());
//		System.out.println(t2.getLikes().length);
//		System.out.println(t2.getLikelist().size());
 
	}
}
